package com.wu.framework.yearning.plus.starter.yearning;


import com.wu.framework.yearning.plus.starter.yearning.api.AuditOrderListDTO;
import com.wu.framework.yearning.plus.starter.yearning.api.LoginDTO;
import com.wu.framework.yearning.plus.starter.yearning.api.command.AuditOrderListCommand;
import com.wu.framework.yearning.plus.starter.yearning.api.command.AuditOrderStateCommand;
import com.wu.framework.yearning.plus.starter.yearning.api.command.LoginCommand;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import org.springframework.web.service.annotation.PutExchange;

@HttpExchange(accept = "application/json", contentType = "application/json")
public interface YearningApi {

    /**
     * 登录
     *
     * @param loginCommand http记录
     */
    @PostExchange("/login")
    LoginDTO login(@RequestBody LoginCommand loginCommand);

    /**
     * 查询审计
     *
     * @param authorization         授权信息
     * @param auditOrderListCommand 查询条件
     * @return 审计信息
     * <p>
     * {payload={data=[{id=0, work_id=20231117104542622, username=qpamlyh, status=0, type=0, backup=1, idc=生产环境, source=博峰僵尸版, source_id=55c5bd08-9db9-4ce9-b28f-013c2774066a, data_base=bill_flow_2278, table=tenant_approval_flow, date=2023-11-17 10:45, sql=, text=创建僵尸版数据库, assigned=吴佳伟,qpamlyh,陟昌龙, delay=none, real_name=娄宇航, execute_time=2023-11-17 10:41, current_step=1, relevant=[提交人, 吴佳伟, qpamlyh, 陟昌龙, admin], osc_info=, file=}, {id=0, work_id=20230428174558125, username=吴佳伟, status=0, type=0, backup=1, idc=生产环境, source=榆林生产数据库, source_id=24819076-1379-4eba-afac-fbf34ea49240, data_base=upms, table=, date=2023-04-28 17:45, sql=, text=-- 系统应用表增加是否站内 1=是 0=否, assigned=吴佳伟, delay=none, real_name=吴佳伟, execute_time=, current_step=1, relevant=[提交人, 吴佳伟, admin], osc_info=, file=}], page=2}, code=1200, text=}
     * </p>
     */
    @PutExchange("/api/v2/audit/order/list")
    AuditOrderListDTO auditOrderList(@RequestHeader("Authorization") String authorization, @RequestBody AuditOrderListCommand auditOrderListCommand);


    /**
     * 审核通过
     *
     * @param authorization         授权
     * @param auditOrderListCommand 审核信息
     * @return 审核结果
     */
    @PostExchange("/api/v2/audit/order/state")
    String auditOrderState(@RequestHeader("Authorization") String authorization, @RequestBody AuditOrderStateCommand auditOrderListCommand);
}
